<template>
	<view class="content">
		<view class="content_time">
			{{itemInvite.datetime}}
		</view>
		<view class="content_delivery-title">
			<!-- 企业邀请您投递简历 -->
			{{itemInvite.self_side == 1?'邀请对方投递简历':'企业邀请您投递简历'}}
		</view>
		<view class="content_item u-border-bottom"  v-if="itemInvite.message">
			<view class="u-flex u-row-between">
				<view class="u-font-36 u-font-weight">
					{{itemInvite.message.jobname}}
				</view>
				<view class="u-font-32" style="color: #ff5017;">
					{{itemInvite.message.wage_text}}
				</view>
			</view>
			<view class="u-flex u-flex-wrap u-m-t-20">
				<view class="content_item_tag">
					{{itemInvite.message.education_text}}
				</view>
				<view class="content_item_tag">
					{{itemInvite.message.experience_text}}
				</view>
				<view class="content_item_tag">
					{{itemInvite.message.district_text}}
				</view>
			</view>
		</view>
		<view class="delivery-bottom" v-if="itemInvite.message">
			<view v-if="itemInvite.self_side == 1">
				<view class="delivery-btn delivery-btn-ac" v-if="itemInvite.message.status==0">等待对方投递</view>
				<view class="delivery-btn" v-else @click="handleSeeResume">对方已投递 立即查看</view>
			</view>
			<view v-else>
				<view class="delivery-btn" v-if="itemInvite.message.status == 0" @click="handleDeliverResume">投递简历
				</view>
				<view class="delivery-btn delivery-btn-ac" v-else>已投递</view>
			</view>
		</view>
	</view>
</template>

<script setup>
	import {
		ref,
		watch
	} from 'vue'
	import {
		useUserIm
	} from '/stores/userIm.js'
	const IM = useUserIm()
	const itemInvite = ref({})
	const props = defineProps({
		itemInvite: Object,
		cid:[String,Number]
	})
	watch(()=>props.itemInvite,(nv)=>{
		itemInvite.value = nv
	},{
		immediate:true,
		deep:true
	})
	// 投递简历
	const handleDeliverResume = () => {
		var msgObj = {
			controller: 'SendInvite',
			action: 'applyjob',
			args: {
				token: IM.imToken,
				messageid: itemInvite.value.messageid,
				cids:props.cid,
				content:'对方已投递简历',
				title:uni.getStorageSync('userName')
			}
		}
		IM.webSocket_send(msgObj)
	}
	// 查看简历
	const handleSeeResume = () => {
		uni.$u.route('pages/pagesHome/detailPages/resume', {
			id: itemInvite.value.message.resumeid
		})
	}
</script>

<style lang="scss" scoped>
	.content {
		margin-bottom: 60rpx;

		&_time {
			text-align: center;
			margin: 46rpx 0 28rpx 0;
			color: #999999;
			font-size: 24rpx;
		}

		//发送职位开始 / 企业邀请投递简历开始
		&_delivery-title {
			width: 90vw;
			color: #333333;
			font-size: 36rpx;
			height: 98rpx;
			line-height: 98rpx;
			font-weight: bold;
			border-bottom: 2rpx solid #e8e8e8;
			margin: 0 auto;
			background: #fff;
			padding: 0 30rpx;
		}

		&_item {
			width: 90vw;
			margin: 0 auto;
			background-color: #fff;
			border-radius: 10rpx;
			font-size: 28rpx;
			padding: 20rpx 30rpx;

			&_tag {
				color: #666666;
				font-size: 28rpx;
				margin-right: 12rpx;
				background: #F8F8F8;
				padding: 10rpx 16rpx;
			}
		}

	}

	.delivery-bottom {
		width: 90vw;
		margin: 0 auto;
		padding: 32rpx 0 24rpx;
		background: #fff;

		.delivery-btn {
			width: 500rpx;
			height: 70rpx;
			background: #00D075;
			border-radius: 34rpx;
			text-align: center;
			line-height: 70rpx;
			color: #fff;
			margin: 0 auto 0;

			&.delivery-btn-ac {
				background: #CECECE;
			}
		}
	}
</style>